SG Window Overview

SG Window |
Overview | © 1998 by Stinga
Reference Order Now! License How To...
Introduction

Thank you for evaluating SG Window. SG Window is Automation compatible component that exposes Win32 window API through the rich set of properties and methods. You can manage native Win32 windows by using properties and methods of the SG Window component:

  • subclass window and receive window messages in two ways: through events and/or through fast interface callbacks. No more hazardous AddressOf operator.
  • subclass window without writing one line of a code: use our SG Window Wizard add-in
  • encapsulate message handling code with reusable classes
  • effortlessly retrieve and update various window attributes through SG Window properties and methods.
  • enumerate windows using SG Window collections
  • find specific window
  • create windows and handle all messages from VB code
  • call API functions without clumsy Declare statements
  • add user interface to WSH scripts
  • ideal for VBScript® or JScript® scripts
  • SG Window is small, fast and does not need any external DLLs
  • and much, much more ...

SG Window is one stop solution for all of your window API needs.

To use a SG Window object in your application, you must add the reference to SGWINDOW.DLL file to your project. If you find yourself using it in most of your Visual Basic projects, you can add it to Visual Basic® Autoload file.
When you want to distribute applications which are using SG Window object, you must install and register it on the user's computer. VB Setup Wizard will help you do this.

Demo version of the SG Window is 100% functional but from time to time it will display registration remainder dialog box. On-line registration is available at www.stinga.com.

New versions and bug fixes can be found at http://www.stinga.com/sgwindow

Supported Platforms

SG Window is tested on Microsoft® Windows® 95, Windows® 98 and Windows® NT 4.0.

Contact Info

If you have any suggestions or ideas for new features and controls, or if you have any bugs to report please contact us. Your input is welcome at:

Stinga, Nova Cesta 151, 10000 Zagreb, Croatia
Web: http://www.stinga.com/sgwindow
E-mail: sgwindow@stinga.com


Distribution Notes

SG Window |
Distribution Notes | ©1998 by Stinga
Overview Reference How To... FAQ
Distributable Files

SG Window does not need any runtime DLLs. All you need to distribute is SGWINDOW.DLL file.

To distribute applications and scripts that use SG Window you must include SGWINDOW.DLL into your setup program and register it on a client machine. SGWINDOW.DLL contains version info and you should ensure that setup program is not overwriting a newer version of SG Window. SGWINDOW.DLL is self registering module and you can register it with

REGSVR32.EXE /S SGWINDOW.DLL

command or you can let VB Setup Wizard create installation program for your VB projects.

Note that you are not allowed to distribute any source code that you have recived

Supported Platforms

SG Window is tested on Microsoft® Windows® 95, Windows® 98 and Windows® NT 4.0.


Ordering Information

SG Window |
Ordering Information | ©1998 by Stinga
Overview Reference License How To...

SG Window can be ordered by secure online form, toll free phone or by postal mail. Choose one of our registration providers listed below.

IMPORTANT: all numbers and addresses listed on this page are for ORDERS ONLY. For tech support or information about our products, please contact us at:

Stinga, Nova Cesta 151, Zagreb 10000, Croatia
Web: http://www.stinga.com/sgwindow
E-mail: sgwindow@stinga.com

Pricing:
A site license for Stinga components entitles an organization to receive one copy of the distribution package and to deploy it on the specified number of computers. See the table below for site license pricing.

Single computer: | $24
2-10 computers: | $17
11-20 computers: | $15
More than 20 computers: | $299

Provider Description
Register SG Window through Register Now!
  • Secure online ordering (Visa, MasterCard, American Express or Discover (Novus)).
    Click on a Register Now! to open secure online ordering form.
    Click here to see why it's safe to Order online.
Register SG Window through ShareIt!

  • Secure online ordering (Visa, MasterCard, American Express or Diners Club).
    Click on a ShareIt! to open secure online ordering form.

  • US toll free phone: 1-800-903-4152 (orders only please!).

  • Fax or mail. Please print this form and mail or fax it to:

    Germany office:
    element 5 AG
    Habsburgerring 3
    50674 Koeln
    Germany

    Phone: +49-221-2407279
    Fax:+49-221-2407278
    E-Mail: register@shareit.com

    USA office:
    ShareIt! Inc.
    P.O. Box 97841
    Pittsburgh, PA 15227-0241
    USA

For online registration you'll receive your registration code shortly after your order via email.

Registration Benefits

Registered user can redistribute the runtimes free of royalties when shipping applications to customers.

Registered user can get runtime DLL which is smaller and does not contain remainder screen code and resources.

Registered user is entitled to free minor version updates.

Registered user can get free E-mail technical support.

How does Register Now! security work
seal.gif (4857 bytes) Register Now! uses a VeriSign certificate for Secure Socket Layer (SSL) transactions. VeriSign certificates offer strong RSA-based encryption for secure transactions and allow a wider variety of browsers to be used than with certificates from other companies. Netscape Navigator versions starting at 2.0 are supported as well as Microsoft Internet Explorer versions 3.0 and above.
All of this means that your credit card information is sent directly to the credit card processor in a very secure manner, so that nobody else can see it. That protects you by ensuring that nobody but you and the credit card processor will see your card.

Please visit http://www.stinga.com/sgwindow for news and new versions.


SG Window Order Form

SG Window |
SG Window Order Form | ©1998 by Stinga
Overview Reference License How To... FAQ

Please print out the following form, and fax or mail it to addresses listed below:

==========================================================
Registration form for SG Window

Program No.: 101934

Last name: ___________________________________

First name: ____________________________________

Company: ____________________________________

Street and #: ______________________________________

City, State, postal code: ________________________________

Country: _______________________________________

Phone: _____________________________________

Fax: ________________________________________

E-Mail: ______________________________________

How would you like to receive the registration key/full version?

e-mail - fax - postal mail

How would you like to pay the registration fee of $24:

credit card - wire transfer - EuroCheque - cash

Credit card information (if applicable)

Credit card: Visa - Eurocard/Mastercard - American Express - Diners Club

Card holder: ________________________________

Card No.: ___________________________________

Date of Expiration : ___________________________________

Date / Signature ___________________________

==========================================================

element 5 AG
Habsburgerring 3
50674 Koeln
Germany

Phone: +49-221-2407279
Fax: +49-221-2407278
E-Mail: register@shareit.com

US customers may also order by calling 1-800-903-4152 (orders only please!). US check and cash orders can be sent to our US office at

ShareIt! Inc.
PO Box 844
Greensburg, PA 15601-0844
USA

Tel. 724-850-8186
Fax. 724-850-8187


License Agreement

SG Window |
License Agreement | © 1998 by Stinga
Overview Reference Registration How To...

PLEASE READ THE FOLLOWING LICENSE AGREEMENT. IT WILL BE NECESSARY FOR YOU TO AGREE TO BE BOUND BY THE TERMS OF THIS AGREEMENT BEFORE BEING PERMITTED TO CONTINUE TO DOWNLOAD AND/OR INSTALL THE PRODUCT.

LICENSE AGREEMENT FOR STINGA SOFTWARE:

VERY IMPORTANT - READ CAREFULLY: This Stinga Software License Agreement (hereinafter "LICENSE") is a legal agreement between you (either an individual or a single entity) and Stinga (hereinafter "STINGA"), for the SOFTWARE or products on this web site, and may include "on-line" or electronic documentation (hereinafter "SOFTWARE"). By installing and/or using the SOFTWARE, you agree to be bound by the terms of this LICENSE. If you do not agree to the terms of this LICENSE, do not download and/or use SOFTWARE from STINGA.

SOFTWARE LICENSE

Copyright laws and international copyright treaties, as well as other intellectual property laws and treaties protect the SOFTWARE. The SOFTWARE is licensed, not sold.

I. LICENSE GRANTS. This LICENSE grants you the following rights:
A. You may use one copy of the STINGA SOFTWARE identified above on a single computer. The SOFTWARE is in "use" on a computer when it is loaded into temporary memory (i.e. RAM) or installed into permanent memory (e.g. hard disk, CD-ROM, or other storage devise) of that computer. However, installation on a network server for the sole purpose of internal distribution to one or more other computer(s) shall not constitute "use" for which a separate license is required, provided you have a separate license for each computer to which the SOFTWARE is distributed.

B. Solely with respect to electronic documents included with the SOFTWARE, you may make a copy (either in hardcopy or electronic form), provided that the number of copies made shall not exceed the number of licenses you own for that SOFTWARE, and further provided that such copies shall be used only for internal purposes and are not republished or distributed to any third party.

II. TITLE; COPYRIGHT.
All title and copyrights in and to the SOFTWARE (including but not limited to any images, photographs, animation, video, audio, music, text and "applets" incorporated into the SOFTWARE), the accompanying printed materials, and any copies of the SOFTWARE are owned by STINGA or its suppliers. Copyright laws and international treaty provisions protect the SOFTWARE. Therefore, you must treat the SOFTWARE like any other copyrighted material, except that you may either (A) make one copy of the SOFTWARE solely for backup or archival purposes or (B) install the SOFTWARE on a single computer provided you keep the original solely for backup or archival purposes.

III. ADDITIONAL RIGHTS AND LIMITATIONS.

A. No Separation of Components. The SOFTWARE is licensed as a single product and the software programs comprising the SOFTWARE may not be separated for use by more than one user at a time.

B. Rental. You may not rent or lease the SOFTWARE.

C. Software Transfer. You may NOT transfer any of your rights under this LICENSE.

D. Termination. Without prejudice to any other rights, STINGA may terminate this LICENSE if you fail to comply with the terms and conditions of this LICENSE. In such event, you must destroy all copies of the SOFTWARE.

IV. REDISTRIBUTABLE COMPONENTS.
A. Source Code and Sample Code. In addition to the license granted in Section 1, STINGA grants you the right to use and modify the source code versions of those portions of the SOFTWARE which are identified in the documentation as the Source Code and Sample Code of the SOFTWARE, either on disk, CD-ROM or electronic format (collectively "SOURCE CODE") provided you comply with section 4.c. You may NOT distribute the SOURCE CODE, or any modified version of the SOURCE CODE, in source code form.
B. Redistributable Code. In addition to the license granted in Section 1, STINGA grants you a nonexclusive, royalty-free right to reproduce and distribute the object code version of those portions of the SOFTWARE designated in the SOFTWARE as (I) those portions of the SOFTWARE which are identified in the documentation as the OCX ("OCX") Controls; and (II) those portions of the SOFTWARE which are identified in the documentation as REDISTRIBUTABLE DLLs ("DLLs"), provided you comply with Section 4.c.
C. Redistribution Requirements. If you redistribute the REDISTRIBUTABLES, you agree to (I) distribute the REDISTRIBUTABLES in object code form only in conjunction with and as part of your software application product which adds significant and primary functionality and which is designed, developed, and tested to operate in the Microsoft Windows and/or Windows NT environments; (II) not use STINGA's name, logo or trademarks to market your software application product; (III) include a valid copyright notice on your SOFTWARE; (IV) indemnify, hold harmless, and defend STINGA from and against any claims or lawsuits, including attorney's fees, that arise or result from the use and distribution of your software application product; and (V) not permit further distribution of the REDISTRIBUTABLES by your end user.

V. CROATIAN LAW.
Croatian copyright law description is described under paragraphs (NN53/91) and (NN58/93) defines software copyrights with sanction against violator described in subparagraph (95) and (96) and penalties for violators described in subparagraph (101) (103) and (103b). Croatian law can prosecute all violators by Croatian law and violator's domicile state law. Manufacturer is STINGA, Nova Cesta 151, Zagreb 10000, Croatia.

LIMITED WARRANTY

LIMITED WARRANTY. EXCEPT WITH RESPECT TO REDISTRIBUTABLES, WHICH ARE PROVIDED "AS IS," WITHOUT WARRANTY OF ANY KIND, STINGA WARRANTS THAT THE SOFTWARE WILL PERFORM SUBSTANTIALLY IN ACCORDANCE WITH THE ACCOMPANYING WRITTEN MATERIALS FOR A PERIOD OF THIRTY (30) DAYS FROM THE DATE OF RECEIPT. SOME STATES AND JURISDICTIONS DO NOT ALLOW LIMITATIONS OF DURATION OF AN IMPLIED WARRANTY, SO THE ABOVE LIMITATION MAY NOT APPLY TO YOU. TO THE EXTENT ALLOWED BY APPLICABLE LAW, IMPLIED WARRANTIES ON THE SOFTWARE, IF ANY, ARE LIMITED TO THIRTY (30) DAYS.

CUSTOMER REMEDIES. STINGA'S AND ITS SUPPLIERS' ENTIRE LIABILITY AND YOUR EXCLUSIVE REMEDY SHALL BE, AT STINGA'S OPTION, EITHER

(A) RETURN OF THE PAID PRICE, OR (B) REPAIR OR REPLACEMENT OF THE SOFTWARE. PRODUCTS PURCHASED OTHER THAN DIRECTLY FROM STINGA SHALL BE RETURNED THROUGH THE RESELLER FROM WHICH IT WAS PURCHASED. THIS LIMITED WARRANTY IS VOID IF FAILURE OF THE SOFTWARE HAS RESULTED FROM ACCIDENT, ABUSE, OR MISAPPLICATION. ANY REPLACEMENT SOFTWARE WILL BE WARRANTED FOR THE REMAINDER OF THE ORIGINAL THIRTY (30) DAY PERIOD.

NO OTHER WARRANTIES. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, STINGA AND ITS SUPPLIERS DISCLAIM ALL OTHER WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, WITH REGARD TO THE SOFTWARE. THIS LIMITED WARRANTY GIVES YOU SPECIFIC LEGAL RIGHTS. YOU MAY HAVE OTHERS, WHICH VARY FROM STATE/JURISDICTION TO STATE/JURISDICTION.

NO LIABILITIES FOR CONSEQUENTIAL DAMAGES. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT SHALL STINGA OR ITS SUPPLIERS BE LIABLE FOR ANY SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR INABILITY TO USE THE SOFTWARE, EVEN IF STINGA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. BECAUSE SOME STATES AND JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES, THE ABOVE LIMITATION MAY NOT APPLY TO YOU.

LICENSEE ACKNOWLEDGES THAT IT HAS READ AND UNDERSTANDS THIS AGREEMENT AND AGREES TO BE BOUND BY ITS TERMS. LICENSEE FURTHER AGREES THAT THIS AGREEMENT IS THE COMPLETE AND EXCLUSIVE STATEMENT OF THE AGREEMENT BETWEEN LICENSEE AND LICENSOR, AND SUPERCEDES ANY PROPOSAL OR PRIOR AGREEMENT, ORAL OR WRITTEN, AND ANY OTHER COMMUNICATIONS RELATING TO THE SUBJECT MATER OF THIS AGREEMENT.


SG Window Reference

SG Window |
Reference | ©1998 by Stinga


SG Window Objects

SG Window |
SG Window Objects | ©1998 by Stinga
Callbacks Events Constants Error Codes How To...

These are object exposed by SG Window library:

Window Object | main object
Windows Collection | collection of Window objects
Globals Object | helper methods


Window Object

SG Window |
Window Object | ©1998 by Stinga
Reference Properties Methods Events Events Constants Errors How To...
ProgID | SGWindow.Window
CLSID | A4F879B0-FA60-11d1-9828-204C4F4F5020
Description

Window object encapsulates Win32 window API in a rich set of easy to use properties and methods. With it, VB programmer can do almost anything a C/C++ programmer can:

  • subclass window and receive window messages in two ways: through events and/or through fast interface callbacks. No more hazardous AddressOf operator.
  • subclass window without writing one line of a code: use our SG Window Wizard add-in
  • effortlessly retrieve and update various window attributes through SG Window properties and methods.
  • enumerate windows using SG Window collections
  • find specific window
  • create windows and handle all messages from VB code
  • call API functions without clumsy Declare statements
  • ideal for VBScript or JavaScript scripts
  • and much, much more ...
Remarks

SG Window is not an ActiveX control and does not need to be placed on the form to be used. It is an automation compatible server component and can be used from a class module or regular BAS module.
This example shows how to use Window from the class module:

' Declare Window object
Private mWnd As Window

' Attach window handle
Public Property Let hWnd(h as Long)
   mWnd.hWnd = h
   If h <> 0 Then
      mWnd.EnableMessage WM_MOUSEWHEEL
      mWnd.Hooked = True
   Else
      mWnd.EnableMessage WM_MOUSEWHEEL, False
      mWnd.Hooked = False
   End If
End Property

' Standard initialization/destruction
Private Sub Class_Initialize()
   Set mWnd = new SGWindow.Window
End Sub
Private Sub Class_Terminate()
   Set mWnd = Nothing
End Sub

' Message event handler
Private Sub mWnd_Message(ByVal msg As Long, ByVal wParam As Long, _
                         ByVal lParam As Long, ByRef result As Long)
   Select Case msg
      Case WM_MOUSEWHEEL
      ' Put some cool code here
   End Select
End Sub


Window Properties

©1998 by Stinga

Properties Methods Events Constants Error Codes

Children | Returns collection of child windows
Class | Returns window class name
ContextHelpId | Returns or sets window help context identifier
Enabled | Enables or disables window
ExStyle | Returns or sets extended window style
Height | Returns or sets window's height
hIcon | Returns or sets window icon handle
hInstance | Returns the handle of the application instance
hMenu | Returns or sets window's menu handle
Hooked | Enables or disables message hooking
hWnd | Returns or sets handle of the window to which sgObject is attached
Icon | Returns or sets window icon
Id | Returns or sets window's child identifier
InProcess | Returns True if attached window belongs to the running process
Left | Returns or sets window's left coordinate
Parent | Returns or sets parent window
ProcessId | Returns ID of the process that owns the thread that created this window
State | Returns or sets window state (minimized, maximized or restored)
Style | Returns or sets window style
SystemMenu | Returns window's system menu handle
Tag | Returns or sets custom data associated with this window object
Text | Returns or sets window text
ThreadId | Returns ID of the thread that created this window
Top | Returns or sets window's top coordinate
TopLevelParent | Returns top-level parent window
UserData | Returns or sets user data associated with the window
Visible | Shows or hides window
Width | Returns or sets window's width
WindowLong | Returns or sets 32-bit window information value


Untitled

Children Property

Description

Returns collection of child windows. Read only.

Syntax

object.Children

The object is expression that evaluates to the Window object.

Remarks

Windows collection is a static snapshot. Items are determined at the moment collection is created, so if you cache this collection be aware that some windows may have been destroyed by the time they are used.


Class Property

See Also Properties Methods Events Constants Error Codes
Description

Name of the window calss. Read only.

Syntax

object.Class

The object is expression that evaluates to the Window object.

Remarks

Window class is a set of attributes that Microsoft® Windows® uses as a template to create a window in an application. Class property is attached window class name.


Enbaled Property

Description

Enables or disables mouse and keyboard input to the attached window.

Syntax

object.Enabled

The object is expression that evaluates to the Window object.


Height Property

Description

Height is window's height.

Syntax

object.Height

The object is expression that evaluates to the Window object.

Remarks

Value of the Height property is expressed in pixels.


WindowContextHelpId Property

ContextHelpId Property

Description

Returns or sets window help context identifier.

Syntax

object.ContexHelpId

The object is expression that evaluates to the Window object.

Remarks

If window does not have associated context help identifier, this property returns zero.


hIcon Property

See Also Properties Methods Events Constants Error Codes
Description

Returns or sets window's icon hadle (HICON).

Syntax

object.hIcon(size as IconSize)

Part | Description
object | The object is expression that evaluates to the Window object.
size | Required. Size of the icon to retrieve or set. Value for the size parameter can be obtained from the IconSize enumeration.


hInstance Property

See Also Properties Methods Events Constants Error Codes
Description

Handle of the application instance. Read only.

Syntax

object.hInstance

The object is expression that evaluates to the Window object.

Remarks

hInstance is handle of the application instance of the attached window.


hMenu Property

See Also Properties Methods Events Constants Error Codes
Description

Window's menu handle.

Syntax

object.hMenu

The object is expression that evaluates to the Window object.

Remarks

hMenu is handle of the menu associated with the window attached to Window object. Child windows do not have a menu.


hFont Property

SG Window |
hFont Property | ©1998 by Stinga
See Also Properties Methods Events Constants Error Codes
Description

Returns or sets window's font handle.

Syntax

object.hFont

The object is expression that evaluates to the Window object.

Remarks

hFont is handle of the font associated with the window attached to Window object.


Hooked Property

Description

Enables or disables message events.

Syntax

object.Hooked

The object is expression that evaluates to the Window object.

Remarks

When Hooked property is set to True, Window object will subclass attached window, fire events and call registered callback interface methods. Default value for this property is False, so to receive message events you must set it to True.
Normaly you attach window by assigning window handle (hWnd), call EnableMessage to enable events for a specific message and the set Hooked property to True.

There is a difference between FreezeEvents method and Hooked property. Setting Hooked property to False disconnects Window object from the default Win32 window procedure (un-subclasses window). Setting FreezeEvents to False disables event firing but window still remains subclassed.

Example
Public WithEvents w as SGWindow.Window

Sub Form_OnLoad()
   set w = new SgWindow.Window
   w.hWnd = Me.hWnd
   w.EnableMessage wm_COMAND
   w.Hooked = True
End Sub


hWnd Property

Description

hWnd is Win32 API handle of the attached window.

Syntax

object.hWnd

The object is expression that evaluates to the Window object.

Remarks

Allmost all properties and methods of the Window object requires valid value for this property.
One window handle (HWND) can be attached to more than one SGWindow object.


Icon Property

See Also Properties Methods Events Constants Error Codes
Description

Returns or sets window's icon.

Syntax

object.hIcon(size as IconSize)

Part | Description
object | The object is expression that evaluates to the Window object.
size | Required. Size of the icon to retrieve or set. Value for the size parameter can be obtained from the IconSize enumeration.


Id Property

Description

Retrieves or changes the identifier of the child window.

Syntax

object.Id

The object is expression that evaluates to the Window object.


InProcess Property

Description

Returns True if attached window belongs to the running process. Read only.

Syntax

object.InProcess

The object is expression that evaluates to the Window object.


Left Property

Description

Left is window's left coordinate.

Syntax

object.Left

The object is expression that evaluates to the Window object.

Remarks

Value of the Left property is expressed in pixels and is relative to parent's client area.


Parent Property

Description

Returns or sets window's parent window

Syntax

object.Parent

The object is expression that evaluates to the Window object.

Remarks

If the window has no parent, the return value is Nothing.


ProcessId Property

Description

Returns ID of the process that owns the thread that created this window. Read only.

Syntax

object.ProcessId

The object is expression that evaluates to the Window object.


Windows Collection Count Property

SG Window |
Count Property | ©1998 by Stinga
See Also Properties Events Constants Error Codes How To... FAQ
Description

Returns the number of items in a collection. Read-only.

Syntax

object.Count

The object is always the name of Windows collection.

Remarks

The following code illustrates use of the Count property:

Dim w
Set w = CreateObject("SGWindow.Window")
w.AttachDesktop
MsgBox "Child count is " & CStr(w.Children.Count)


Windows Collection Item Property

SG Window |
Item Property | ©1998 by Stinga
See Also Properties Events Constants Error Codes How To... FAQ
Description

Returns Window object based on the specified key. Default, read only.

Syntax

object.Item(key)

The Item property has the following parts:

Part | Description
object | object expression that evaluates to the Windows collection
key | key associated with the Window being retrieved
Remarks

Key can be Integer or String. If it is Integer than it is zero based index of the item in the collection. If key is String than it's syntax is as folows:

"Caption" | specifies window with 'Caption' as window text
"{ID}100" | specifies window with ID equal to 100
"{HWND}100" | specifies window with HWND equal to decimal 100
"{HWND}&H100" | specifies window with HWND equal to hexadecimal 100
Example
Dim w
set w = CreateObject("SGWindow.Window")
w.AttachDesktop
MsgBox "Class name of the first desktop's child is " & w.Children(0).Class


State Property

Description

Returns or sets window show state. Show state can be minimized, maximized or restored.

Syntax

object.State

The object is expression that evaluates to the Window object.

Remarks

State property can be one of the values defined in the WindowState enumeration.


Style Property

See Also Properties Methods Events Constants Error Codes
Description

Manipulates window style flags.

Syntax

object.Style

The object is expression that evaluates to the Window object.

Remarks

Window styles are boolean constants which define the appearance and behavior of windows. SG Window defines style constants in the WinStyle enumeration.

Example

Folowing VB example displays captions of all top level minimized windows:

Dim w As New SGWindow.Window
Dim child As SGWindow.Window
w.AttachDesktop

For Each child In w.Children
   If (child.Style And ws_MINIMIZE) <> 0 Then
      MsgBox child.Text
   End If
Next

This is same example but modified for VBScript:

Const ws_MINIMIZE = &H20000000&

Dim w, child
Set w = CreateObject("SGWindow.Window")
w.AttachDesktop

For Each child In w.Children
   If (child.Style And ws_MINIMIZE) <> 0 Then
      MsgBox child.Text
   End If
Next


SystemMenu Property

Description

Returns window's system menu handle. Read only.

Syntax

object.SystemMenu

The object is expression that evaluates to the Window object.


StyleEx Property

ExStyle Property

See Also Properties Methods Events Constants Error Codes
Description

Manipulates window extended style flags.

Syntax

object.ExStyle

The object is expression that evaluates to the Window object.

Remarks

Window extended styles are boolean constants which define the appearance and behavior of windows. SG Window defines style constants in the WinStyleEx enumeration.

Example

Folowing VB example displays captions of all top level windows that accepts drag-drop files:

Dim w As New SGWindow.Window
Dim child As SGWindow.Window
w.AttachDesktop

For Each child In w.Children
   If (child.ExStyle And WS_EX_ACCEPTFILES) <> 0 Then
      MsgBox child.Text
   End If
Next

This is same example but modified for VBScript:

Const ws_EX_ACCEPTFILES = &H00000010&

Dim w, child
Set w = CreateObject("SGWindow.Window")
w.AttachDesktop

For Each child In w.Children
   If (child.ExStyle And ws_EX_ACCEPTFILES) <> 0 Then
      MsgBox child.Text
   End If
Next


Tag Property

Description

Returns or sets string value that stores any extra data needed for your program. You can use this property to identify Window objects.

Syntax

object.

The object is expression that evaluates to the Window object.


Text Property

See Also Properties Methods Events Constants Error Codes
Description

Returns or sets text from attached window

Syntax

object.Text

The object is expression that evaluates to the Window object.

Remarks

Text can be caption in a case of form or button, or it can be text content for VB Text control.

Example

Following examples retrieves active window's caption and displays it in a message box:

Dim w As New SGWindow.Window
w.AttachActiveWindow
MsgBox w.Text


ThreadId Property

Description

Returns ID of the thread that created this window. Read only.

Syntax

object.ThreadId

The object is expression that evaluates to the Window object.


Top Property

Description

Top is window's top coordinate.

Syntax

object.Top

The object is expression that evaluates to the Window object.

Remarks

Value of the Top property is expressed in pixels and is relative to the parent's client area.


TopLevelParent Property

Description

Returns top-level parent window. Read only.

Syntax

object.TopLevelParent

The object is expression that evaluates to the Window object.


UserData Property

Description

Returns or sets user data associated with the window.

Syntax

object.UserData

The object is expression that evaluates to the Window object.

Remarks

Each window has a corresponding 32-bit value intended for use by the application that created the window.


Version Property

SG Window |
Version Property | ©1998 by Stinga
See Also Properties Methods Events Constants Error Codes
Description

Returns string containig version and build number.

Syntax

object.Version

The object is expression that evaluates to the Window object.

Example
Dim wnd As New SGWindow.Window
MsgBox "SG Window version is " & wnd.Version


Visible Property

Description

Shows or hides window.

Syntax

object.Visible

The object is expression that evaluates to the Window object.


Untitled

Topic Title

Description

Width is window's width.

Syntax

object.Width

The object is expression that evaluates to the Window object.

Remarks

Value of the Width property is expressed in pixels.


WindowLong Property

Description

Returns or sets 32-bit window information value

Syntax

object.WindowLong(index As WLIndex)

Part | Description
object | The object is expression that evaluates to the Window object.
index | Required. Index of the value to retrieve or change. Value of the index can be constant from the WLIndex enumeration.
Remarks

For a detailed explanation of index values please consult Win32 SDK.


Window Methods

Activate | Activates window
AttachActiveWindow | Attach active window
AttachDesktop | Attach desktop window
CallWindowProc | Calls attached window's default window procedure.
Create | Creates new window
Destroy | Destroy attached window and its children
EnableMessage | Enables or disables message events
EnableMessageRange | Enables or disables message events for a range of messages
FindHWND | Returns descendent window with specified HWND
FindWindow | Returns first window whose class name and text match specified strings
FindWindows | Returns collection of windows whose class name and text match specified strings
FlashWindow | Flashes specified window once
FreezeEvents | Stops and enables message events
GetDC | Returns a handle to a window client device context
GetWindowDC | Returns a handle to the entire window device context
Invalidate | Invalidates window's client rectangle
LockWindowUpdate | Enables or disables window updating
PostMessage | Posts a message to the window
PrintClient | Draw window client area to the specified device context
PrintWindow | Draw window to the specified device context
Redraw | Redraws window
ReleaseDC | Releases device context previously returned from GetDC or GetWindowDC methods
ResetSystemMenu | Resets the system menu back to the Windows default state
SendKeys | Send one or more keystrokes to the window
SendMessage | Sends a message to the window
SetFocus | Sets the keyboard focus to the window
SetMessageCallback | Sets message callback interface
SetPaintCallback | Sets paint callback interface
SetPosition | Sets window's position and size in one step


Activate Method

Description

Activates window.

Syntax

object.Activate

Part | Description
object | The object is expression that evaluates to Window object
Remarks

Activates the window. Keyboard input is directed to the window, and various visual cues are changed for the user.


AttachActiveWindow Method

Description

Attach active window.

Syntax

object.AttachActiveWindow

Part | Description
object | The object is expression that evaluates to Window object
Remarks

Finds active window and attaches it's handle to this Window object.


AttachDesktop Method

Description

Attach desktop window.

Syntax

object.AttachDesktop

Part | Description
object | The object is expression that evaluates to Window object
Remarks

Finds desktop window and attaches it's handle to this Window object.


CallWindowProc Method

Description

Calls attached window's default window procedure.

Syntax

object.CallWindowProc(ByVal msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long

Part | Description
object | The object is expression that evaluates to Window object
msg | Required. Message code
wParam | Required. Message specific data
lParam | Required. Message specific data
Remarks

If message is not handled by the message handler (event or callback), you must invoke CallWindowProc method and let default window procedure handle message. How and when you are going to call it depends on what you want to accomplish. In some cases you will handle message entirely in the VB code and you will not call default window procedure at all.
This method should be called only from the message event handler.

Example
Private WithEvents wnd As SGWindow.Window

Sub wnd_Message(msg As Long, wParam As Long, _
            lParam As Long, ByRef result As Long)

   lblText = CStr(msg)
   result = CallWindowProc(msg, wParam, lParam)
End Sub


Create Method

Description

Creates new window.

Syntax

object.Create(className As String, windowText As String, style As WinStyle, styleEx As WinStyleEx, x As Long, y As Long, width As Long, height As Long, hwndParent As Long, menuOrID As Long)

Part | Description
object | The object is expression that evaluates to Window object
className | Name of the window class. className can be one of the predefined Win32 class names or it can be a string returned from RegisterClass method.
windowText | Window text.
style | Window style. Can be combination of style constants defined in the WinStyle enumeration
styleEx | Window extended style. Can be combination of style constants defined in the WinStyleEx enumeration
x | Window left coordinate. In pixels an relative to the parent window client rectangle.
y | Window top coordinate. In pixels an relative to the parent window client rectangle.
width | Window width. In pixels.
height | Window height. In pixels.
hwndParent | Parent window handle.
menuOrID | Menu handle, or child-window identifier.
Remarks

If you pass empty string for className parameter, SG Window will register new class and create window with that class. In this case you are responsible for handling all messages for the created window becasue there is no default window procedure. clsWindow class in the sgWindow.vbp example from your SG Window samples folder shows how you can do it.

For more info please refer to CreateWindow function in Win32 API documetation.

Example

Folowing example creates list view control:

Private wnd As SGWindow.Window

Sub Form_OnLoad()
   set wnd = New SGWindow.Window
   wnd.Create "SysListView32", "", _
       ws_CHILD + ws_BORDER + ws_VISIBLE, _
       0, 10, 10, 400, 300, Me.HWND, 1234
End Sub


Destroy Method

Description

Destroys attached window and its children.

Syntax

object.Destroy

Part | Description
object | The object is expression that evaluates to Window object
Remarks

Destroy can not destroy a window created by a different thread.


DoModal Method

SG Window |
DoModal Method | ©1998 by Stinga
See Also Properties Methods Events Constants Error Codes
Description

Opens modal dialog box.

Syntax

object.DoModal(resFile As String, dlgTemplate, left As Long, top As Long, Optional initParam As Long = 0)

Part | Description
object | The object is expression that evaluates to Window object
resFile | String that specifies where is the dialog template resource located. This is usually name of the file containing dialog resource.
dlgTemplate | Name or identifier of the dialog template. Can be string that specifies the name of the dialog box template (i.e. "DLG_EMPTY") or an integer value that specifies the resource identifier of the dialog box template.
left, top | Dialog's initial top-left corner coordinate. In screen pixel coordinates.
initParam | Optional. Specifies the value to pass to the dialog box in the lParam parameter of the WM_INITDIALOG message.
Remarks

DoModal method creates modal dialog box from a specified dialog box template resource. Resource template is located in the file specified by resFile parameter:

resFile Value | Description
"" | Empty string. Dialog box template is located in the SGWINDOW.DLL module.
"file_spec" | Dialog box template is located in the file 'file_spec"

SGWINDOW.DLL module contains an 'empty' dialog box template. This template (DLG_EMPTY) can be used to create custom dialog boxes. Following code shows how to create such a dialog in the VBScript script:

option explicit

const wm_CLOSE      = &H0010
const wm_INITDIALOG = &H0110
const wm_COMMAND    = &H0111

const ws_CHILD      = &H40000000
const ws_VISIBLE    = &H10000000
const ws_BORDER     = &H00800000
const ws_TABSTOP    = &H00010000

const nCaptionHeight = 25

' Create SGWindow object and connect to its events
Dim g, dlg, rc, ok
Set dlg  = WScript.CreateObject("SGWindow.Window", "dlg_")
Set g    = WScript.CreateObject("SGWindow.Globals")
Set ok   = WScript.CreateObject("SGWindow.Window")

' Show dialog box
rc = dlg.DoModal("", "DLG_EMPTY", 100, 100)

' Clean up and quit
Wscript.DisconnectObject dlg
Set dlg = Nothing
Set ok = Nothing
Set g = Nothing
WScript.Quit

'--------------------------------------------------------------------------
' Dialog box window procedure
'--------------------------------------------------------------------------
Sub dlg_Message(msg, wParam, lParam, result)
   result = 0

   select case msg
     case wm_INITDIALOG
        ' Create OK button
        ok.Create "BUTTON", "OK", WS_CHILD + WS_VISIBLE + WS_BORDER + WS_TABSTOP, _
                        0, 10, dlg.Height - nCaptionHeight - 40, 80, 30, dlg.hWnd, 1
        ok.hFont = dlg.hFont

        ' Set dialog title
        dlg.Text = "SG Window Test Dialog"

     case wm_CLOSE
        dlg.EndDialog 0

     case wm_COMMAND
        Dim bHandled
        bHandled = OnCommand(g.HighWord(wParam), g.LowWord(wParam), lParam)
        if Not bHandled Then
           result = dlg.CallWindowProc(msg, wParam, lParam)
        end if

     case else
        result = dlg.CallWindowProc(msg, wParam, lParam)
   end select
End Sub

'--------------------------------------------------------------------------
' Handle dialog WM_COMMAND messages
'--------------------------------------------------------------------------
Private Function OnCommand(notifyCode, id, hwnd)
   OnCommand = false
   select case id
      case 1 ' OK
         dlg.EndDialog 1
         OnCommand = true
   end select
End Function


DoModeless Method

SG Window |
DoModeless Method | ©1998 by Stinga
See Also Overview Properties Methods Events Constants Error Codes How To... FAQ
Description

Opens modeless dialog box.

Syntax

object.DoModeless resFile As String, dlgTemplate, left As Long, top As Long, Optional initParam As Long = 0

Part | Description
object | The object is expression that evaluates to Window object
resFile | String that specifies where is the dialog template resource located. This is usually name of the file containing dialog resource.
dlgTemplate | Name or identifier of the dialog template. Can be string that specifies the name of the dialog box template (i.e. "DLG_EMPTY") or an integer value that specifies the resource identifier of the dialog box template.
left, top | Dialog's initial top-left corner coordinate. In screen pixel coordinates.
initParam | Optional. Specifies the value to pass to the dialog box in the lParam parameter of the WM_INITDIALOG message.
Remarks

DoModeless method creates modeless dialog box from a specified dialog box template resource and immediately returns control to the caller.

Resource template is located in the file specified by resFile parameter:

resFile Value | Description
"" | Empty string. Dialog box template is located in the SGWINDOW.DLL module.
"file_spec" | Dialog box template is located in the file 'file_spec"

SGWINDOW.DLL module contains an 'empty' dialog box template. This template (DLG_EMPTY) can be used to create custom dialog boxes. Following code shows how to create modeless dialog box using DLG_EMPTY template:

option explicit

' Messages and styles
const wm_CLOSE         = &H0010&
const wm_INITDIALOG    = &H0110&
const wm_COMMAND       = &H0111&
const PBM_SETRANGE     = &H0401&
const PBM_SETPOS       = &H0402&
const PBS_SMOOTH       = &H0001&
const ws_CHILD         = &H40000000
const ws_VISIBLE       = &H10000000
const ws_TABSTOP       = &H00010000

const sMsg = "VBScript is working "

' Global declarations
Dim g, dlg, wProgress, wStatic, i, rc, bCanceled
Set g         = WScript.CreateObject("SGWindow.Globals")
Set dlg       = WScript.CreateObject("SGWindow.Window", "dlg_")
Set wProgress = WScript.CreateObject("SGWindow.Window")
Set wStatic   = WScript.CreateObject("SGWindow.Window")

' Show dialog
' Note that empty string as a resource module instructs
' SGWindow to use it's internal dialog resources.
dlg.DoModeless "", "DLG_EMPTY", 100, 100

' Do something
bCanceled = false
for i = 0 to 1000 step 10

   ' Use Sleep method to give dialog box a chance to handle
   ' it's messages. Note that second parameter (true)
   ' instructs SGWindow to dispatch messages and events during
   ' sleep period.
   g.Sleep 50, true

   ' Update progress bar
   wProgress.SendMessage PBM_SETPOS, i, 0
   wStatic.Text = sMsg & CStr(i) & "/1000"
   if bCanceled Then
      MsgBox "Canceling at " & CStr(i) & "/1000"
      Exit For
   end if
next

' Release objects
Wscript.DisconnectObject dlg
dlg.Destroy
Set dlg = Nothing
Set wProgress = Nothing
Set wStatic = Nothing
Set g = Nothing
WScript.Quit

'--------------------------------------------------------------------------
' Dialog box window procedure
'--------------------------------------------------------------------------
Sub dlg_Message(msg, wParam, lParam, result)
   result = 0
   select case msg
     case wm_INITDIALOG
        ' Initialize and position dialog
        dlg.Text = "WSH Modeless Progress Bar"
        dlg.SetPosition 300, 300, 400, 150

        ' Create progress bar
        wProgress.Create "msctls_progress32", "",
                         WS_CHILD + WS_VISIBLE + PBS_SMOOTH, 0, _
                         20, 20, dlg.Width-45, 25, dlg.hWnd, 100
        wProgress.SendMessage PBM_SETRANGE, 0, g.MakeLong(0, 1000)

        ' Create label
        wStatic.Create "STATIC", sMsg, WS_CHILD + WS_VISIBLE, 0, _
                       20, 50, 255, 25, dlg.hWnd, 101

        ' Create CANCEL button
        Dim w
        Set w = WScript.CreateObject("SGWindow.Window")
        w.Create "BUTTON", "Cancel", WS_CHILD + WS_VISIBLE + WS_TABSTOP, 0, _
                 dlg.Width/2-50, dlg.Height-60, 100, 30, dlg.hWnd, 2
        w.hFont = dlg.hFont
        w.SetFocus

     case wm_CLOSE
       bCanceled = True

     case wm_COMMAND
        Dim bHandled
        bHandled = OnCommand(g.HighWord(wParam), g.LowWord(wParam), lParam)
        if Not bHandled Then
           result = dlg.CallWindowProc(msg, wParam, lParam)
        end if

     case else
        result = dlg.CallWindowProc(msg, wParam, lParam)
   end select
End Sub

'--------------------------------------------------------------------------
' Handle dialog WM_COMMAND messages
'--------------------------------------------------------------------------
Private Function OnCommand(notifyCode, id, hwnd)
   OnCommand = false
   select case id
      case 2 ' CANCEL
         bCanceled = True
         OnCommand = True

   end select
End Function


EnableMessage Method

Description

Enables or disables firing of the Message events and calling of callback interfaces for specified message.

Syntax

object.EnableMessage(msg As WinMsg, Optional enable As Boolean = True)

Part | Description
object | The object is expression that evaluates to Window object
msg | Required. Message code of the message that will be enabled or disabled. WinMsg enumerator lists constants that can be used as a value for this parameter.
enable | Optional. If True message is enabled; otherwise message is disabled. Default value is True.
Remarks

To receive any message, you must enable it using EnableMessage or EnableMessageRange methods. wm_ALL is special message code that can be used to enable or disable all messages.

Example

Following example shows how to enable mouse move messages:

Public WithEvents wnd As SGWindow.Window

Sub Form_OnLoad()
   Set wnd = new SGWindow.Window
   wnd.hWnd = Me.hWnd
   wnd.EnableMessage wm_MOUSEMOVE
   wnd.Hooked = True
End Sub


EnableMessageRange Method

Description

Enables or disables firing of the Message events and calling of callback interfaces for specified messages.

Syntax

object.EnableMessageRange(s tartMsg As WinMsg, endMsg As WinMsg, Optional enable As Boolean = True)

Part | Description
object | The object is expression that evaluates to Window object
startMsg | Required. Message code of the first message that will be enabled or disabled. WinMsg enumerator lists constants that can be used as a value for this parameter.
endMsg | Required. Message code of the last message that will be enabled or disabled. WinMsg enumerator lists constants that can be used as a value for this parameter.
enable | Optional. If True message is enabled; otherwise message is disabled. Default value is True.
Remarks

To receive any message, you must enable it using EnableMessage or EnableMessageRange methods.

Example

Following example shows how to enable mouse messages:

Public WithEvents wnd As SGWindow.Window

Sub Form_OnLoad()
   Set wnd = new SGWindow.Window
   wnd.hWnd = Me.hWnd
   wnd.EnableMessageRange wm_MOUSEFIRST, wm_MOUSELAST
   wnd.Hooked = True
End Sub


EndDialog Method

SG Window |
EndDialog Method | ©1998 by Stinga
See Also Overview Properties Methods Events Constants Error Codes How To... FAQ
Description

Closes and destroys modal dialog box.

Syntax

object.EndDialog result As Long

Part | Description
object | The object is expression that evaluates to Window object
result | Value to be returned to from the DoModal method.

Remarks

You must use EndDialog method to destroy modal dialog box created by the DoModal method. EndDialog can be called only from within dialog box message handler. This method is usually called as a response to WM_CLOSE message or Ok/Cancel button click.

EndDialog does not destroy the dialog box immediately. Dialog box is destroyed when message handler returns control to the system.

DoModal topic contains example that shows how to use EndDialog method.


FindHWND Method

Description

Returns descendent window with specified HWND.

Syntax

object.FindHWND(hWnd As Long) As Window

Part | Description
object | The object is expression that evaluates to Window object
hWnd | Required. Handle of the window to find.
Remarks

Searches descendent windows for a window with specified handle. If such a window does not exist FindHWND returns Nothing; otherwise return value is Window object attached to the specified handle.


FindWindow Method

Description

Returns first descendent window with matching class name and text.

Syntax

object.FindWindow(className As String, text As String) As Window

Part | Description
object | The object is expression that evaluates to Window object
className | Required. String to search inside the window class name.
text | Required. String to search inside the window text.
Remarks

Enumerates all descendent windows and matches specified class name string and text string against window's class and text. If specified strings are substrings of the window's class and text, FindWindow returns Window object attached to the matched window.
Empty string matches always.

Example

Following example shows how to find window created with running application that has string "Basic" in it's text:

Dim w As SGWindow.Window
Set w = Find("Basic")
Public Function Find(sText$) As Window
   Dim w As New SGWindow.Window
   w.AttachActiveWindow
   Set Find = w.FindWindow("", sText)
End Function


FindWindows Method

Description

Returns Windows collection of descendent windows with matching class name and text.

Syntax

object.FindWindows(className As String, text As String) As Windows

Part | Description
object | The object is expression that evaluates to Window object
className | Required. String to search inside the window class name.
text | Required. String to search inside the window text.
Remarks

Enumerates all descendent windows and matches specified class name string and text string against window's class and text. If specified strings are substrings of the window's class and text, FindWindows creates new Window object attached to the matched window and adds it to the result collection.
Empty string matches always.

Example

Following example shows how to find all windows that contain string "Thunder" in their class name:

   Dim desktop As New SGWindow.Window
   Dim wnd As SGWindow.Window
   Dim coll As SGWindow.Windows

   desktop.AttachDesktop
   Set coll = desktop.FindWindows("Thunder", "")
   For Each wnd in coll
      MsgBox wnd.Class & vbCrLf & wnd.Text
   Next


FlashWindow Method

Description

Flashes window once.

Syntax

object.FlashWindow(invert As Boolean)

Part | Description
object | The object is expression that evaluates to Window object
invert | Required. If this parameter is True the window is flashed from one state to the other. If this parameter is False, the window is returned to its original state.


FreezeEvents Method

Description

Stops and enables message events.

Syntax

object.FreezeEvents(freeze As Boolean)

Part | Description
object | The object is expression that evaluates to Window object
freeze | Required. Specifies whether events are to be fired or not. If this parameter is True, message events for enabled messages are fired and registered callback interfaces are called. If this parameter is False events are not fired and callback interfaces are not called.
Remarks

There is a difference between FreezeEvents method and Hooked property. Setting Hooked property to False disconnects Window object from the default Win32 window procedure (un-subclasses window). Setting FreezeEvents to False disables event firing but window still remains subclassed.


GetDC Method

Description

Returns a handle to a display device context for the client area of the attached window.

Syntax

object.GetDC

Part | Description
object | The object is expression that evaluates to Window object
Remarks

When you are finished with device context returned form GetDC, you must call the ReleaseDC function to release the device context.


GetWindowDC Method

Description

Returns device context for the entire window.

Syntax

object.GetWindowDC

Part | Description
object | The object is expression that evaluates to Window object
Remarks

When you are finished with device context returned form GetWindowDC, you must call the ReleaseDC function to release the device context.


Invalidate Method

Description

Invalidates window's client rectangle.

Syntax

object.Invalidate(eraseBkg as Boolean)

Part | Description
object | The object is expression that evaluates to Window object
eraseBkg | Required. Specifies whether the client are background is to be erased. If this parameter is True, background is erased. If this parameter is False, background is not erased.
Remarks

Invalidating does not repaint window. Window will be painted during next wm_PAINT message. To immidietly redraw window, use Redraw method.


LockWindowUpdate Method

Description

Enables or disables drawing in the specified window.

Syntax

object.LockWindowUpdate(lock As Boolean)

Part | Description
object | The object is expression that evaluates to Window object
lock | Required. Specifies whether window drawing should be disabled (True) or enabled (False).
Remarks

Only one window can be locked at a time.


PostMessage Method

Description

Posts a message to the attached window.

Syntax

object.PostMessage(msg As WinMsg, wParam As Long, lParam As Long)

Part | Description
object | The object is expression that evaluates to Window object
msg | Required. Message code.
wParam | Required. Message specific data.
lParam | Required. Message specific data.
Remarks

The PostMessage function places (posts) a message in the message queue associated with the thread that created the specified window and then returns without waiting for the thread to process the message.


PrintClient Method

Description

Paint window client area to the specified device context.

Syntax

object.PrintClient(hdc As Long, flags As WndPrintFlags)

Part | Description
object | The object is expression that evaluates to Window object
hdc | Required. Handle of the device context to draw in.
flags | Required. Drawing options. See remarks section for more details.
Remarks

The PrintClient method sends WM_PRINTCLIENT message to the window to request that it draw its client area in the specified device context. Note that windows are not required to handle WM_PRINTCLIENT message.

flags parameter can be combination of values defined in the WndPrintFlags enumeration:

Value | Meaning
prf_CHECKVISIBLE | Draw the window only if it is visible.
prf_CHILDREN | Draw all visible children windows.
prf_CLIENT | Draw the client area of the window.
prf_ERASEBKGND | Erase the background before drawing the window.
prf_NONCLIENT | Draw the nonclient area of the window.
prf_OWNED | Draw all owned windows.


PrintWindow Method

Description

Paint window to the specified device context.

Syntax

object.PrintWindow(hdc As Long, flags As WndPrintFlags)

Part | Description
object | The object is expression that evaluates to Window object
hdc | Required. Handle of the device context to draw in.
flags | Required. Drawing options. See remarks section for more details.
Remarks

The PrintWindow method sends WM_PRINT message to the window to request that it draw itself in the specified device context. Note that windows are not required to handle WM_PRINT message.

flags parameter can be combination of values defined in the WndPrintFlags enumeration:

Value | Meaning
prf_CHECKVISIBLE | Draw the window only if it is visible.
prf_CHILDREN | Draw all visible children windows.
prf_CLIENT | Draw the client area of the window.
prf_ERASEBKGND | Erase the background before drawing the window.
prf_NONCLIENT | Draw the nonclient area of the window.
prf_OWNED | Draw all owned windows.


Redraw Method

Description

Redraws attached window.

Syntax

object.Redraw(Optional flags As RedrawFlag = rdw_ERASE + rdw_INVALIDATE + rdw_UPDATENOW)

Part | Description
object | The object is expression that evaluates to Window object
flags | Optional. Specifies redraw flags. Value must be combination of the constants defined in the RedrawFlag enumeration.
Remarks

flags parameter must be combination of these constants:

rdw_INVALIDATE | Invalidate entire window
rdw_INTERNALPAINT | Causes a WM_PAINT message to be posted to the window regardless of whether any portion of the window is invalid
rdw_ERASE | Causes the window to receive a WM_ERASEBKGND message when the window is repainted.
rdw_VALIDATE | Validates entire window
rdw_NOINTERNALPAINT | Suppresses any pending internal WM_PAINT messages.
rdw_NOERASE | Suppresses any pending WM_ERASEBKGND messages
rdw_NOCHILDREN | Excludes child windows, if any, from the repainting operation
rdw_ALLCHILDREN | Includes child windows, if any, in the repainting operation
rdw_UPDATENOW | Causes the affected windows to receive WM_NCPAINT, WM_ERASEBKGND, and WM_PAINT messages, if necessary, before the function returns.
rdw_ERASENOW | Causes the affected windows to receive WM_NCPAINT and WM_ERASEBKGND messages, if necessary, before the function returns.
rdw_FRAME | Causes any part of the nonclient area of the window to receive a WM_NCPAINT message.
rdw_NOFRAME | Suppresses any pending WM_NCPAINT messages


ReleaseDC Method

Description

Releases device context previously returned from GetDC or GetWindowDC methods

Syntax

object.ReleaseDC(hdc As Long)

Part | Description
object | The object is expression that evaluates to Window object
hdc | Required. Device context to be released.
Remarks

Call ReleaseDC method to release device context handle previously returned from GetDC or GetWindowDC methods.


ResetSystemMenu Method

Description

Resets the system menu back to the Windows default state.

Syntax

object.ResetSystemMenu

Part | Description
object | The object is expression that evaluates to Window object
Remarks

Use ResetSystemMenu method to cancel changes you have made to the window's system menu.


SendKeys Method

Description

Sends one or more keystrokes to the window as if typed at the keyboard.

Syntax

object.SendKeys(keys As String, Optional wait As Boolean = True, Optional activeWin As Boolean = False)

Part | Description
object | The object is expression that evaluates to Window object
keys | Required. String specifying the keystrokes to send.
wait | Optional. If True keystrokes are processed before control is returned to the caller. If False control is returned to the caller as soon as keystrokes are sent. Default value is True.
activeWin | Optional. If True keystrokes are sent to the currently active window. If False keystrokes are sent to the window attached to Window object. Default value is False.
Remarks

Keystrokes string contains keys represented with one or more characters. Keyboard characters are represented by themselves. For example, character string "AB" represents letters A and B.

The plus sign (+), caret (^), percent sign (%), tilde (~), and parentheses () have special meanings to SendKeys. To specify one of these characters, enclose it within braces ({}). For example, to specify the plus sign, use {+}. To specify brace characters, use {{} and {}}.

To specify other keys use codes in this table:

Key | Code
SHIFT | +
CTRL | ^
ALT | %
BACKSPACE | {BACKSPACE}, {BS}, or {BKSP}
BREAK | {BREAK}
CAPS LOCK | {CAPSLOCK}
DEL or DELETE | {DELETE} or {DEL}
DOWN ARROW | {DOWN}
END | {END}
ENTER | {ENTER} or ~
ESC | {ESC}
HELP | {HELP}
HOME | {HOME}
INS or INSERT | {INSERT} or {INS}
LEFT ARROW | {LEFT}
NUM LOCK | {NUMLOCK}
PAGE DOWN | {PGDN}
PAGE UP | {PGUP}
PRINT SCREEN | {PRTSC}
RIGHT ARROW | {RIGHT}
SCROLL LOCK | {SCROLLLOCK}
TAB | {TAB}
UP ARROW | {UP}
F1 | {F1}
F2 | {F2}
F3 | {F3}
F4 | {F4}
F5 | {F5}
F6 | {F6}
F7 | {F7}
F8 | {F8}
F9 | {F9}
F10 | {F10}
F11 | {F11}
F12 | {F12}
F13 | {F13}
F14 | {F14}
F15 | {F15}
F16 | {F16}

To specify repeating keys, use the form {key number}. You must put a space between key and number. For example, {LEFT 42} means press the LEFT ARROW key 42 times; {h 10} means press H 10 times.

Example

Following example shows how to use SendKeys from VBScript script. It starts standard file find dialog and serches for files named NOTEPAD.EXE.

Dim wnd, desktop, g
Set desktop = CreateObject("SGWindow.Window")
Set g = CreateObject("SGWindow.Globals")
desktop.AttachDesktop

' Activate FileFind dialog
Set wnd = desktop.FindWindow("Progman", "")
wnd.SendKeys "{F3}", true, true

' Wait for FileFind to pop up
g.sleep 1000

' Start search
wnd.SendKeys "notepad.exe{TAB 2}c+;\~", true, true


SendMessage Method

Description

Sends a message to the attached window.

Syntax

object.SendMessage(msg As WinMsg, wParam As Long, lParam As Long) As Long

Part | Description
object | The object is expression that evaluates to Window object
msg | Required. Message code.
wParam | Required. Message specific data.
lParam | Required. Message specific data.
Remarks

The SendMessage function sends the specified message to a window. The function calls the window procedure for the specified window and does not return until the window procedure has processed the message.
The Return value is the result of the message processing and depends on the message sent.


SetFocus Method

Description

Sets the keyboard focus to the attached window.

Syntax

object.SetFocus

Part | Description
object | The object is expression that evaluates to Window object


SetMessageCallback Method

Description

Set interface whose methods will be called when there is a new message in the attached window message queue.

Syntax

object.SetMessageCallback(sink As Object)

Part | Description
object | The object is expression that evaluates to Window object
sink | Required. Object that implements IsgMessageSink interface.
Remarks

SG Window supports two methods for message handling: standard events and callback interfaces. To receive messages through callback interface you must implement IsgMessageSink interface in the class or form module. When you have this interface implemented, enable message with EnableMessage method and subclass window with Hooked property.

Example

Following example shows how to implement and use IsgMessageSink interface in the class module:

' Declare interface
Implements IsgMessageSink

' SGWindow object
Private mWnd As SGWindow.Window

Private Sub Class_Initialize()
   ' Initialize SGWindow object
   Set mWnd = New SGWindow.Window
   mWnd.EnableMessage wm_MOUSEWHEEL
   mWnd.Hooked = True
   mWnd.SetMessageCallback Me
End Sub

' Message handler
Private Sub IsgMessageSink_Message(ByVal msg As Long, ByVal wParam As Long, ByVal lParam As Long, ByRef result As Long)
   result = mWnd.CallWindowProc(msg, wParam, lParam)
End Sub


SetPaintCallback Method

Description

Set interface whose methods will be called when there are new WM_PAINT or WM_NCPAINT messages in the attached window message queue.

Syntax

object.SetPaintCallback(sink As Object)

Part | Description
object | The object is expression that evaluates to Window object
sink | Required. Object that implements IsgPaintSink interface.
Remarks

SG Window enables you to handle paint messages with fast IsgPaintSink callback interface. When this interface is implemented and registered with SetPaintCallback method, Window object will call GetFlags method to determine what to paint and what interface methods to call.

Example

Following example shows how to implement and use IsgPaintSink interface in the class module:

' Declare interface
Implements IsgPaintSink

' SGWindow object
Private mWnd As SGWindow.Window

Private Sub Class_Initialize()
   ' Initialize SGWindow object
   Set mWnd = New SGWindow.Window
   mWnd.Hooked = True
   mWnd.SetPaintCallback Me
End Sub

Private Function IsgPaintSink_GetFlags() As sgWindow.PaintFlag
   ' Draw client area, and use default frame painting
   IsgPaintSink_GetFlags = pfClientPaint
End Function

Private Sub IsgPaintSink_FramePaint(ByVal hdc As Long)
   ' Use default frame painting
End Sub

Private Sub IsgPaintSink_ClientPaint(ByVal hdc As Long, ByVal left As Long, ByVal top As Long, ByVal right As Long, ByVal bottom As Long)
   ' Draw rectangle over whole client area
   Dim rc As RECT
   GetClientRect mWnd.HWND, rc
   Rectangle hdc, 0, 0, rc.right, rc.bottom
End Sub


SetPosition Method

Description

Sets window's position and size in one step.

Syntax

object.SetPosition(left As Single, top As Single, width As Single, height As Single)

Part | Description
object | The object is expression that evaluates to Window object
left | Required. Specifies new left window coordinate.
top | Required. Specifies new top window coordinate.
width | Required. Specifies new window width.
height | Required. Specifies new window height.
Remarks

All coordinates are in pixels and relative to parent window client area.


Window Events

Methods Properties Events Constants Error Codes

Message Occures when message is received


Message Event

Properties Methods Constants Error Codes
Description

Fired when enabled message is received by attached window.

Syntax

Private Sub window_Message(ByVal msg As Long, ByVal wParam As Long, ByVal lParam As Long, ByRef result As Long)

Part | Description
window | Expression that evaluates to Window object
msg | Received message code.
wParam | Message specific data
lParam | Message specific data
result | Message result code
Remarks

Message event occurs when one of the enabled messages is received by the attached window.

Values and interpretation of wParam and lParam parameters depends on received message. Please consult Win32 API documentation for more details on parameters passed with different messages.

If message is not handled in the event procedure, you must call CallWindowProc method and let default window procedure handle message. How and when you are going to call it depends on what you want to accomplish. In some cases you will handle message entirely in the VB code and you will not call default window procedure at all.

Result is window procedure return value. You must update value of the result parameter according to the received message. Win32 API documentation contains info about these return values.

Be aware that you should avoid putting breakpoints into the message event handler. You can use Debug.Print statement to find out what is happening inside message handler.

Example
Const PBT_APMQUERYSUSPEND  = 0
Const BROADCAST_QUERY_DENY = &H424D5144&

Private WithEvents mWnd As SGWindow.Window

Private Sub Form_OnLoad()
   Set mWnd = New SGWindow.Window
   mWnd.hWnd = Me.hWnd
   mWnd.EnableMessage wm_POWERBROADCAST
   mWnd.Hooked = True
End Sub
Private Sub mWnd_Message(ByVal msg As Long, _
            ByVal wParam As Long, ByVal lParam As Long, _
            ByRef result As Long)

   If wParam = PBT_APMQUERYSUSPEND Then
      ' Deny suspend mode
      result = BROADCAST_QUERY_DENY
   Else
      ' Default message processing
      result = mWnd.CallWindowProc(msg, wParam, lParam)
   End If
End Sub


Windows Collection

SG Window |
Windows Collection | ©1998 by Stinga
Reference Properties Methods Events Constants Errors How To...
Description

Windows object is a collection of Window objects. It can be retrieved as a result of a FindWindows method or from the Children property of the Window object

Remarks

Windows collection is a static snapshot. Items are determined at the moment collection is created, so if you cache this collection be aware that some windows may have been destroyed by the time they are used.


Windows Properties

SG Window |
Windows Properties | ©1998 by Stinga
Overview Windows Methods Events Constants Errors How To... FAQ
Count Property | number of Window objects in a collection
Item Property | returns specified Window object - default property


Globals Object

SG Window |
Globals Object | ©1998 by Stinga
Reference Properties Methods Events Constants Errors How To...
ProgID | SGWindow.Globals
CLSID | BB0FDE70-26EF-11d2-8E49-008048E27A77
Description

Globals object is a collection of usefull properties and methods, not necessarily connected with windows API or specific window. Think of it as a library of general routines. Globals object is default SG Window Library object and it's members can be accessed without explicitly created Globals object. For example you can use it like this:

Dim lowWord%
lowWord = SGWindow.LowWord(12345678)

Note that in VBScript you must create Globals object before you can use it's members. VBScript version of code snippet should look like this:

Dim g, lowWord
Set g = CreateObject("SGWindow.Globals")
lowWord = g.LowWord(12345678)

Properties

DesktopWindow
ActiveWindow

Methods

GetFocused
RegisterClass
Sleep
LowWord
HighWord
MakeLong
LowByte
HighByte
MakeWord


Globals Properties

Objects Methods Events Constants Error Codes
DesktopWindow | returns desktop window
ActiveWindow | returns or sets active window


Desktop Property

DesktopWindow Property

Description

Returns desktop window. Read only.

Syntax

object.DesktopWindow

The object is expression that evaluates to the Globals object.

Remarks

DesktopWindow property returns Window object which is attached to the desktop window.

Example
MsgBox "Desktop window class is " & SGWindow.DesktopWindow.Class


ActiveWindow Property

Description

Returns or sets active window.

Syntax

object.ActiveWindow

The object is expression that evaluates to the Globals object.

Remarks

ActiveWindow property returns Window object which is attached to the currently active window.


Globals Methods

Objects Globals Properties Constants Error Codes
GetFocused | returns window that has the keyboard focus
RegisterClass | registers a window class
Sleep | suspends running thread
LowWord | returns low word of the specified Long value
HighWord | returns high word of the specified Long value
MakeLong | returns long value constructed from low and high words
LowByte | returns low byte of the specified word value
HighByte | returns high byte of the specified word value
MakeWord | returns word value constructed from low and high bytes


GetFocus Method

GetFocused Method

Description

Returns the window that has the keyboard focus.

Syntax

object.GetFocused

The object is expression that evaluates to the Globals object.


HighByte Method

Description

Returns high byte of the specified integer value

Syntax

object.HighByte(value As Integer)

Part | Description
object | The object is expression that evaluates to the Globals object.
value | Required. Specifies the value to be converted.


HighWord Method

Description

Returns high word of the specified long value

Syntax

object.HighWord(value As Long)

Part | Description
object | The object is expression that evaluates to the Globals object.
value | Required. Specifies the value to be converted.


LowByte Method

Description

Returns low byte of the specified integer value.

Syntax

object.LowByte(value As Integer)

Part | Description
object | The object is expression that evaluates to the Globals object.
value | Required. Specifies the value to be converted.


LowWord Method

Description

Returns low word of the specified long value

Syntax

object.LowWord(value As Long)

Part | Description
object | The object is expression that evaluates to the Globals object.
value | Required. Specifies the value to be converted.


MakeLong Method

Description

Creates Long (32-bit) value by concatenating two given Integer (16-bit) values.

Syntax

object.MakeLong(low As Integer, high As Integer)

Part | Description
object | The object is expression that evaluates to the Globals object.
low | Required. Specifies the low-order word of the new long value.
high | Required. Specifies the high-order word of the new long value.


MakeWord Method

Description

Creates Integer (16-bit) value by concatenating two given byte (8-bit) values.

Syntax

object.MakeWord(low As Byte, high As Byte)

Part | Description
object | The object is expression that evaluates to the Globals object.
low | Required. Specifies the low-order byte of the new Integer value.
high | Required. Specifies the high-order byte of the new Integer value.


RegisterClass Method

Description

The RegisterClass method registers a window class for subsequent use in calls to the Create method of the Window object. Returns string that uniquely identifies the class being registered.

Syntax

object.RegisterClass(style As ClassStyle)

Part | Description
object | The object is expression that evaluates to the Globals object.
style | Optional. New window class style. Class styles are constants from ClassStyle enumeration.
Remarks

All window classes that an application registers are unregistered when it terminates.

Windows 95: All window classes that a DLL registers are unregistered when the DLL is unloaded.

Windows NT: Windows classes that a DLL registers are not unregistered when the DLL is unloaded.


Sleep Method

Description

Suspends execution of the running thread for the specified number of milliseconds.

Syntax

object.Sleep(milliseconds As Long, Optional doEvents as Boolean)

Part | Description
object | The object is expression that evaluates to the Globals object.
milliseconds | Required. Number of milliseconds to wait. Values equal to or less than zero are not valid.
doEvents | Optional. If True events are dispetched during sleep time. Default value is False.


SG Window Callback interfaces

SG Window |
Callback Interfaces | ©1998 by Stinga
Objects Constants Error Codes How To...

SG Window library defines two interfaces: IsgMessageSink and IsgPaintSink. If you implement these interfaces in a VB module and attach this implementation to the SG Window object, interface methods are called from the window object. That's why we call them callback interfaces.

IsgMessageSink

IsgMessageSink interface contains only one method: Message. This method is called when there is a new enabled message in the window's message queue.

IsgPaintSink

IsgPaintSink is interface specialized for window drawing. It's methods are called when window's client or frame should be painted.


IsgMessageSink Callback

SG Window |
IsgMessageSink Interface | ©1998 by Stinga
Constants Error Codes How To... FAQ
IID: | 378564E1-F8D0-11d1-9826-204C4F4F5020
Defined in: | SGWINDOW.DLL
Implemented by: | SG Window clients
Called by: | SG Window object

IsgMessageSink interface is used to inform SG Window clients that new message is available. When new message arrives, SG Window object calls Message method of the IsgMessageSink interface.

To receive messages through message sink interface, you should implement it in the class or form module and register that implementation with the SG Window object.

Methods in Vtable Order
Message Called when new message arrives


Message Method

IsgMessageSink Constants Error Codes
Description

Called when new message arrives.

Syntax

Private Sub IsgMessageSink_Message(ByVal msg As Long, ByVal wParam As Long, ByVal lParam As Long, ByRef result As Long)

Part | Description
IsgMessageSink | Name of the implemented interface.
msg | Received message code.
wParam | Message specific data.
lParam | Message specific data.
result | Message result code.
Remarks

You implement IsgMessageSink interface and it's Message method when you want to receive messages through fast callback interface.

Values and interpretation of wParam and lParam parameters depends on received message. Please consult Win32 API documentation for more details on parameters passed with different messages.

If message is not handled in the Message method, you must call CallWindowProc method and let default window procedure handle message. How and when you are going to call it depends on what you want to accomplish. In some cases you will handle message entirely in the VB code and you will not call default window procedure at all.

Result is window procedure return value. You must update value of the result parameter according to the received message. Win32 API documentation contains info about these return values.

Example

Following example shows how to implement and use IsgMessageSink interface in the class module:

' Declare message callback interface
Implements IsgMessageSink

' Declare SGWindow object
Private mWnd As SGWindow.Window

Private Sub Class_Initialize()
   ' Crete object
   Set mWnd = New SGWindow.Window

   ' Enable messages
   mWnd.EnableMessage wm_MOUSEWHEEL

   ' Attach callback interface
   mWnd.SetMessageCallback Me
End Sub

Private Sub Class_Terminate()
   ' Destroy object
   Set mWnd = Nothing
End Sub

Private Sub IsgMessagesink_Message(ByVal msg As Long, ByVal wParam As Long, _
                    ByVal lParam As Long, ByRef result As Long)
   ' Write some useful code here ...
   Debug.Print CStr(LowWord(lParam))

   ' ... and/or call default window procedure
   result = mWnd.CallWindowProc(msg, wParam, lParam)
End Sub

' Attach this class to the window
Public Property Let hWnd(hwnd as long)
   mWnd.hWnd = hwnd
   If hwnd <> 0 then
      mWnd.Hooked = True
   Else
      mWnd.Hooked = False
   End If
End Property


IsgPaintSink Callback

SG Window |
IsgPaintSink Interface | ©1998 by Stinga
Constants Error Codes How To... FAQ
IID: | 59664360-2576-11d2-8E48-008048E27A77
Defined in: | SGWINDOW.DLL
Implemented by: | SG Window clients
Called by: | SG Window object

IsgPaintSink interface is used to inform SG Window clients that window needs to be painted. SG Window object calls GetFlags method to determine which areas (window frame and/or window client area) client will paint. With this info, SG Window decides whether it will call ClientPaint and/or FramePaint methods, and when these methods are going to be called.

To receive messages through paint sink interface, you should implement it in the class or form module and register that implementation with the SG Window object.

Methods in Vtable Order
GetFlags | Called to determine what areas of the window should be painted by client code.
ClientPaint | Called when client area of the window should be painted.
FramePaint | Called when frame area of the window should be painted.


GetFlags Method

IsgPaintSink Constants Error Codes
Description

Called to determine what areas of the window should be painted by client code.

Syntax

Private Function IsgPaintSink_GetFlags() As sgWindow.PaintFlag

Remarks

GetFlags method should return combination of flags defined in the PaintFlag enumeration:

Constant | Value | Description
pfClientPaint | 1 | SG Window will call user defined ClientPaint procedure. If pfClientAfterDefault flag is not specified, default window procedure will not be called.
pfClientAfterDefault | 2 | ClientPaint procedure will be called after default window procedure.
pfFramePaint | 4 | Call user defined FramePaint procedure. If pfFrameAfterDefault flag is not specified, default window procedure will not be called.
pfFrameAfterDefault | 8 | FramePaint procedure will be called after default window procedure.
Example

In the following sample, client code instructs SG Window object not to invoke default window client-area painting (client code will do all client area painting), and that client code want to paint on the frame area after default non-client painting is finished.

Private Function IsgPaintSink_GetFlags() As sgWindow.PaintFlag
   IsgPaintSink_GetFlags = pfClientPaint + _
                           pfFramePaint + pfFrameAfterDefault
End Function


ClientPaint Method

IsgPaintSink Constants Error Codes
Description

Called when client area of the window should be painted.

Syntax

Private Sub IsgPaintSink_ClientPaint(ByVal hdc As Long, ByVal left As Long, ByVal top As Long, ByVal right As Long, ByVal bottom As Long)

Part | Description
hdc | Handle of the client area device context. Used as a parameter for all drawing functions.
left, top, right, bottom | Coordinates of the smallest rectangle that completely encloses window's update region expressed in pixels relative to the window client area rectangle.
Remarks

When you implement IsgPaintSink interface this method must contain code responsible for client-area painting.

Example

Following example draws rectangle over window client area:

Private mWnd As SGWindow.Window

Private Sub IsgPaintSink_ClientPaint(ByVal hdc As Long, ByVal left As Long, _
            ByVal top As Long, ByVal right As Long, ByVal bottom As Long)

   ' Draw rectangle over whole client area
   Dim rc As RECT
   GetClientRect mWnd.HWND, rc
   Rectangle hdc, 0, 0, rc.right, rc.bottom
End Sub


FramePaint Method

IsgPaintSink Constants Error Codes
Description

Called when frame area of the window should be painted.

Syntax

Private Sub IsgPaintSink_FramePaint(ByVal hdc As Long)

Part | Description
hdc | Handle of the window device context. Used as a parameter for all drawing functions.
Remarks

When you implement IsgPaintSink interface this method must contain code responsible for frame (non-client) area painting.


Constants

SG Window |
Constants | ©1998 by Stinga
Objects Callbacks Error Codes How To...

Window Messages
Window Styles
Window Extended Styles
Window State Constants
Window Handle Constants
Window Print Constants
WindowLong Index Constants
Icon Size constants
PaintFlag Constants
Redraw Constants


WinMsg Constants

SG Window |
WinMsg Constants | ©1998 by Stinga
Overview Constants Error Codes How To... FAQ

wm_ALL | &HFFFF&
wm_NULL | &H0000&
wm_CREATE | &H0001&
wm_DESTROY | &H0002&
wm_MOVE | &H0003&
wm_SIZE | &H0005&
wm_SETFOCUS | &H0007&
wm_KILLFOCUS | &H0008&
wm_ENABLE | &H000A&
wm_SETREDRAW | &H000B&
wm_SETTEXT | &H000C&
wm_GETTEXT | &H000D&
wm_GETTEXTLENGTH | &H000E&
wm_PAINT | &H000F&
wm_CLOSE | &H0010&
wm_QUERYENDSESSION | &H0011&
wm_QUIT | &H0012&
wm_QUERYOPEN | &H0013&
wm_ERASEBKGND | &H0014&
wm_SYSCOLORCHANGE | &H0015&
wm_ENDSESSION | &H0016&
wm_SHOWWINDOW | &H0018&
wm_WININICHANGE | &H001A&
wm_SETTINGCHANGE | &H001A&
wm_DEVMODECHANGE | &H001B&
wm_ACTIVATEAPP | &H001C&
wm_FONTCHANGE | &H001D&
wm_TIMECHANGE | &H001E&
wm_CANCELMODE | &H001F&
wm_SETCURSOR | &H0020&
wm_MOUSEACTIVATE | &H0021&
wm_CHILDACTIVATE | &H0022&
wm_QUEUESYNC | &H0023&
wm_GETMINMAXINFO | &H0024&
wm_PAINTICON | &H0026&
wm_ICONERASEBKGND | &H0027&
wm_NEXTDLGCTL | &H0028&
wm_SPOOLERSTATUS | &H002A&
wm_DRAWITEM | &H002B&
wm_MEASUREITEM | &H002C&
wm_DELETEITEM | &H002D&
wm_VKEYTOITEM | &H002E&
wm_CHARTOITEM | &H002F&
wm_SETFONT | &H0030&
wm_GETFONT | &H0031&
wm_SETHOTKEY | &H0032&
wm_GETHOTKEY | &H0033&
wm_QUERYDRAGICON | &H0037&
wm_COMPAREITEM | &H0039&
wm_COMPACTING | &H0041&
wm_WINDOWPOSCHANGING | &H0046&
wm_WINDOWPOSCHANGED | &H0047&
wm_POWER | &H0048&
wm_COPYDATA | &H004A&
wm_CANCELJOURNAL | &H004B&
wm_NOTIFY | &H004E&
wm_INPUTLANGCHANGEREQUEST | &H0050&
wm_INPUTLANGCHANGE | &H0051&
wm_TCARD | &H0052&
wm_HELP | &H0053&
wm_USERCHANGED | &H0054&
wm_NOTIFYFORMAT | &H0055&
wm_CONTEXTMENU | &H007B&
wm_STYLECHANGING | &H007C&
wm_STYLECHANGED | &H007D&
wm_DISPLAYCHANGE | &H007E&
wm_GETICON | &H007F&
wm_SETICON | &H0080&
wm_NCCREATE | &H0081&
wm_NCDESTROY | &H0082&
wm_NCCALCSIZE | &H0083&
wm_NCHITTEST | &H0084&
wm_NCPAINT | &H0085&
wm_NCACTIVATE | &H0086&
wm_GETDLGCODE | &H0087&
wm_NCMOUSEMOVE | &H00A0&
wm_NCLBUTTONDOWN | &H00A1&
wm_NCLBUTTONUP | &H00A2&
wm_NCLBUTTONDBLCLK | &H00A3&
wm_NCRBUTTONDOWN | &H00A4&
wm_NCRBUTTONUP | &H00A5&
wm_NCRBUTTONDBLCLK | &H00A6&
wm_NCMBUTTONDOWN | &H00A7&
wm_NCMBUTTONUP | &H00A8&
wm_NCMBUTTONDBLCLK | &H00A9&
wm_KEYFIRST | &H0100&
wm_KEYDOWN | &H0100&
wm_KEYUP | &H0101&
wm_CHAR | &H0102&
wm_DEADCHAR | &H0103&
wm_SYSKEYDOWN | &H0104&
wm_SYSKEYUP | &H0105&
wm_SYSCHAR | &H0106&
wm_SYSDEADCHAR | &H0107&
wm_KEYLAST | &H0108&
wm_IME_STARTCOMPOSITION | &H010D&
wm_IME_ENDCOMPOSITION | &H010E&
wm_IME_COMPOSITION | &H010F&
wm_IME_KEYLAST | &H010F&
wm_INITDIALOG | &H0110&
wm_COMMAND | &H0111&
wm_SYSCOMMAND | &H0112&
wm_TIMER | &H0113&
wm_HSCROLL | &H0114&
wm_VSCROLL | &H0115&
wm_INITMENU | &H0116&
wm_INITMENUPOPUP | &H0117&
wm_MENUSELECT | &H011F&
wm_MENUCHAR | &H0120&
wm_ENTERIDLE | &H0121&
wm_CTLCOLORMSGBOX | &H0132&
wm_CTLCOLOREDIT | &H0133&
wm_CTLCOLORLISTBOX | &H0134&
wm_CTLCOLORBTN | &H0135&
wm_CTLCOLORDLG | &H0136&
wm_CTLCOLORSCROLLBAR | &H0137&
wm_CTLCOLORSTATIC | &H0138&
wm_MOUSEFIRST | &H0200&
wm_MOUSEMOVE | &H0200&
wm_LBUTTONDOWN | &H0201&
wm_LBUTTONUP | &H0202&
wm_LBUTTONDBLCLK | &H0203&
wm_RBUTTONDOWN | &H0204&
wm_RBUTTONUP | &H0205&
wm_RBUTTONDBLCLK | &H0206&
wm_MBUTTONDOWN | &H0207&
wm_MBUTTONUP | &H0208&
wm_MBUTTONDBLCLK | &H0209&
wm_MOUSEWHEEL | &H020A&
wm_MOUSELAST | &H020A&
wm_PARENTNOTIFY | &H0210&
wm_ENTERMENULOOP | &H0211&
wm_EXITMENULOOP | &H0212&
wm_SIZING | &H0214&
wm_CAPTURECHANGED | &H0215&
wm_MOVING | &H0216&
wm_POWERBROADCAST | &H0218&
wm_DEVICECHANGE | &H0219&
wm_IME_SETCONTEXT | &H0281&
wm_IME_NOTIFY | &H0282&
wm_IME_CONTROL | &H0283&
wm_IME_COMPOSITIONFULL | &H0284&
wm_IME_SELECT | &H0285&
wm_IME_CHAR | &H0286&
wm_IME_KEYDOWN | &H0290&
wm_IME_KEYUP | &H0291&
wm_MDICREATE | &H0220&
wm_MDIDESTROY | &H0221&
wm_MDIACTIVATE | &H0222&
wm_MDIRESTORE | &H0223&
wm_MDINEXT | &H0224&
wm_MDIMAXIMIZE | &H0225&
wm_MDITILE | &H0226&
wm_MDICASCADE | &H0227&
wm_MDIICONARRANGE | &H0228&
wm_MDIGETACTIVE | &H0229&
wm_MDISETMENU | &H0230&
wm_ENTERSIZEMOVE | &H0231&
wm_EXITSIZEMOVE | &H0232&
wm_DROPFILES | &H0233&
wm_MDIREFRESHMENU | &H0234&
wm_MOUSEHOVER | &H02A1&
wm_MOUSELEAVE | &H02A3&
wm_CUT | &H0300&
wm_COPY | &H0301&
wm_PASTE | &H0302&
wm_CLEAR | &H0303&
wm_UNDO | &H0304&
wm_RENDERFORMAT | &H0305&
wm_RENDERALLFORMATS | &H0306&
wm_DESTROYCLIPBOARD | &H0307&
wm_DRAWCLIPBOARD | &H0308&
wm_PAINTCLIPBOARD | &H0309&
wm_VSCROLLCLIPBOARD | &H030A&
wm_SIZECLIPBOARD | &H030B&
wm_ASKCBFORMATNAME | &H030C&
wm_CHANGECBCHAIN | &H030D&
wm_HSCROLLCLIPBOARD | &H030E&
wm_QUERYNEWPALETTE | &H030F&
wm_PALETTEISCHANGING | &H0310&
wm_PALETTECHANGED | &H0311&
wm_HOTKEY | &H0312&


WinStyle Constants

SG Window |
WinStyle Constants | ©1998 by Stinga
Reference Events Constants Error Codes

Constant | Hexadecimal Value | Decimal Value
ws_OVERLAPPED | &H00000000& | 0
ws_POPUP | &H80000000& | 2147483648
ws_CHILD | &H40000000& | 1073741824
ws_MINIMIZE | &H20000000& | 536870912
ws_VISIBLE | &H10000000& | 268435456
ws_DISABLED | &H08000000& | 134217728
ws_CLIPSIBLINGS | &H04000000& | 67108864
ws_CLIPCHILDREN | &H02000000& | 33554432
ws_MAXIMIZE | &H01000000& | 16777216
ws_CAPTION | &H00C00000& | 12582912
ws_BORDER | &H00800000& | 8388608
ws_DLGFRAME | &H00400000& | 4194304
ws_VSCROLL | &H00200000& | 2097152
ws_HSCROLL | &H00100000& | 1048576
ws_SYSMENU | &H00080000& | 524288
ws_THICKFRAME | &H00040000& | 262144
ws_GROUP | &H00020000& | 131072
ws_TABSTOP | &H00010000& | 65536
ws_MINIMIZEBOX | &H00020000& | 131072
ws_MAXIMIZEBOX | &H00010000& | 65536
ws_TILED | &H00000000& | 0
ws_ICONIC | &H20000000& | 536870912
ws_SIZEBOX | &H00040000& | 262144
ws_OVERLAPPEDWINDOW | &H00CF0000& | 13565952
ws_POPUPWINDOW | &H80880000& | 2156396544
ws_CHILDWINDOW | &H40000000& | 1073741824
ws_TILEDWINDOW | &H00CF0000& | 13565952


WinStyleEx Constants

SG Window |
WinStyleEx Constants | ©1998 by Stinga
Reference Events Constants Error Codes

Constant | Hexadecimal Value | Decimal Value
ws_EX_DLGMODALFRAME | &H00000001& | 1
ws_EX_NOPARENTNOTIFY | &H00000004& | 4
ws_EX_TOPMOST | &H00000008& | 8
ws_EX_ACCEPTFILES | &H00000010& | 16
ws_EX_TRANSPARENT | &H00000020& | 32
ws_EX_MDICHILD | &H00000040& | 64
ws_EX_TOOLWINDOW | &H00000080& | 128
ws_EX_WINDOWEDGE | &H00000100& | 256
ws_EX_CLIENTEDGE | &H00000200& | 512
ws_EX_CONTEXTHELP | &H00000400& | 1024
ws_EX_RIGHT | &H00001000& | 4096
ws_EX_LEFT | &H00000000& | 0
ws_EX_RTLREADING | &H00002000& | 8192
ws_EX_LTRREADING | &H00000000& | 0
ws_EX_LEFTSCROLLBAR | &H00004000& | 16384
ws_EX_RIGHTSCROLLBAR | &H00000000& | 0
ws_EX_CONTROLPARENT | &H00010000& | 65536
ws_EX_STATICEDGE | &H00020000& | 131072
ws_EX_APPWINDOW | &H00040000& | 262144
ws_EX_OVERLAPPEDWINDOW | &H00000300& | 768
ws_EX_PALETTEWINDOW | &H00000188& | 392


WindowState Constants

Reference Events Constants Error Codes

Constant | Hexadecimal Value | Decimal Value
sgRestored | &H00000001& | 1
sgMinimized | &H00000002& | 2
sgMaximized | &H00000003& | 3


WLIndex Constants

Reference Events Constants Error Codes

Constant | Hexadecimal Value | Decimal Value
gwl_WNDPROC | &HFFFFFFFC& | -4
gwl_HINSTANCE | &HFFFFFFFA& | -6
gwl_HWNDPARENT | &HFFFFFFF8& | -8
gwl_STYLE | &HFFFFFFF0& | -16
gwl_EXSTYLE | &HFFFFFFEC& | -20
gwl_USERDATA | &HFFFFFFEB& | -21
gwl_ID | &HFFFFFFF4& | -12
dwl_DLGPROC | &H00000004& | 4
dwl_MSGRESULT | &H00000000& | 0
dwl_USER | &H00000008& | 8
Remarks

For a detailed explanation of index values please consult Win32 SDK.


WndPrintFlags Constants

SG Window |
WndPrintFlags Constants | ©1998 by Stinga
Reference Events Constants Error Codes

Constant | Hexadecimal Value | Decimal Value
prf_CHECKVISIBLE | &H01& | 1
prf_NONCLIENT | &H02& | 2
prf_CLIENT | &H04& | 4
prf_ERASEBKGND | &H08& | 8
prf_CHILDREN | &H10& | 16
prf_OWNED | &H20& | 32


RedrawFlag Constants

SG Window |
RedrawFlag Constants | ©1998 by Stinga
Reference Events Constants Error Codes

Constant | Hexadecimal Value | Decimal Value
rdw_INVALIDATE | &H0001& | 1
rdw_INTERNALPAINT | &H0002& | 2
rdw_ERASE | &H0004& | 4
rdw_VALIDATE | &H0008& | 8
rdw_NOINTERNALPAINT | &H0010& | 16
rdw_NOERASE | &H0020& | 32
rdw_NOCHILDREN | &H0040& | 64
rdw_ALLCHILDREN | &H0080& | 128
rdw_UPDATENOW | &H0100& | 256
rdw_ERASENOW | &H0200& | 512
rdw_FRAME | &H0400& | 1024
rdw_NOFRAME | &H0800& | 2048


IconSize Constants

Reference Events Constants Error Codes

Constant | Hexadecimal Value | Decimal Value
Small_16x16 | &H00000010& | 16
Big_32x32 | &H00000020& | 32


IconSize Constants

SG Window |
ClassStyle Constants | ©1998 by Stinga
Reference Events Constants Error Codes

Constant | Hexadecimal Value | Decimal Value
cs_VREDRAW | &H0001& | 1
cs_HREDRAW | &H0002& | 2
cs_DBLCLKS | &H0008& | 8
cs_OWNDC | &H0020& | 32
cs_CLASSDC | &H0040& | 64
cs_PARENTDC | &H0080& | 128
cs_NOCLOSE | &H0200& | 512
cs_SAVEBITS | &H0800& | 2048
cs_BYTEALIGNCLIENT | &H1000& | 4096
cs_BYTEALIGNWINDOW | &H2000& | 8192
cs_GLOBALCLASS | &H4000& | 16384


PaintFlag Constants

SG Window |
PaintFlag Constants | ©1998 by Stinga
Reference Events Constants Error Codes

Constant | Hexadecimal Value | Decimal Value
pfClientPaint | &H01 | 1
pfClientAfterDefault | &H02 | 2
pfFramePaint | &H04 | 4
pfFrameAfterDefault | &H08 | 8


Error Codes

SG Window |
Error Codes | ©1998 by Stinga
Reference How To...

Error Code | Error Description
1001 | No window attached to the sgWindow object
1002 | Invalid message range
1003 | Specified object does not support IsgMessageSink interface.
1004 | Can not hook/unhook window while message is processed
1005 | Can not change window handle (HWND) while message is processed
1006 | No child windows
1007 | Specified child can not be found
1008 | Invalid index
1009 | Invalid HDC parameter
1010 | Can not create window. sgWindow object is allready attached to the window (HWND) handle.
1011 | Specified object is not an icon
1012 | Specified object does not support IsgPaintSink interface.


Handling Massages

SG Window |
Handling Massages | ©1998 by Stinga
Overview Reference How To... FAQ

One of the most important features of the SG Window is to enable processing of the window messages from the Visual Basic programs. To intercept window messages, SG Window subclasses a window and inserts custom window procedure into the window's message processing chain.
It is possible to subclass a window using VB's AddressOf operator, but it has many drawbacks:

  • function that is going to be used with AddressOf operator must be placed in a standard .BAS module.
  • it is difficult to attach more than one handler to one window. Being able to attach more than one message handler to one window enables you to build reusable message handling components (e.g. mouse wheel component).
  • when you work with function pointers, it is easy to make a mistake and crash IDE.
  • for more info on AddressOf operator please read the VB Books Online article Passing Function Pointers to DLL Procedures and Type Libraries.

SG Window gives you two methods for message handling:

  • Standard events. When there is a new message in the window message queue, SG Window fires event that can be catched in the form or class module.
  • Callback interface. If there is a registered message callback interface, SG Window object will call its Message method when there is a new message in the message queue.
Standard Events

To receive window message events, follow these simple steps:

  1. Declare SG Window object in the form or class module. Use WithEvents keyword to connect to the SG Window events.
  2. Create SG Window object
  3. Enable messages
  4. Write message event handler code
' Declare SGWindow object
Private WithEvents mWnd As SGWindow.Window

Private Sub Form_OnLoad()
   ' Crete object
   Set mWnd = New SGWindow.Window

   ' Enable messages
   mWnd.EnableMessage wm_MOUSEWHEEL
   mWnd.hWnd = Me.hWnd
   mWnd.Hooked = True
End Sub

Private Sub mWnd_Message(ByVal msg As Long, ByVal wParam As Long, _
                    ByVal lParam As Long, ByRef result As Long)
   ' Write some useful code here ...

   ' ... and/or call default window procedure
   result = mWnd.CallWindowProc(msg, wParam, lParam)
End Sub
Message Callback interface

SG Window defines message callback interface which you can implement in the form or class module. When you attach your implementation of this interface to the SG Window object, interface's Message method will be called whenever new message arrives. Message callbacks mechanism is faster than event handling and you will use it when speed is important.

Following is an example of a callback interface implemented in the class module:

' Declare message callback interface
Implements IsgMessageSink

' Declare SGWindow object
Private mWnd As SGWindow.Window

Private Sub Class_Initialize()
   ' Crete object
   Set mWnd = New SGWindow.Window

   ' Enable messages
   mWnd.EnableMessage wm_MOUSEWHEEL

   ' Attach callback interface
   mWnd.SetMessageCallback Me
End Sub

Private Sub Class_Terminate()
   ' Destroy object
   Set mWnd = Nothing
End Sub

Private Sub IsgMessagesink_Message(ByVal msg As Long, ByVal wParam As Long, _
                    ByVal lParam As Long, ByRef result As Long)
   ' Write some useful code here ...
   Debug.Print CStr(LowWord(lParam))

   ' ... and/or call default window procedure
   result = mWnd.CallWindowProc(msg, wParam, lParam)
End Sub

' Attach this class to the window
Public Property Let hWnd(hwnd as long)
   mWnd.hWnd = hwnd
   If hwnd <> 0 then
      mWnd.Hooked = True
   Else
      mWnd.Hooked = False
   End If
End Property
Remarks

If message is not handled by the message handler, you must invoke CallWindowProc method and let default window procedure handle message. How and when you are going to call it depends on what you want to accomplish. In some cases you will handle message entirely in the VB code and you don't need to call default window procedure at all.

SG Window Wizard

To simplify use of the SG Window component, we have created SG Window Wizard; a VB add-in that inserts all code required to intercept messages in your VB code. You can find wizard's source code in the samples subfolder of the SG Window installation folder.


Callback Interfaces (How to)

SG Window |
Callback Interfaces | ©1998 by Stinga
Overview Reference How To... FAQ

An interface is a collection of prototypes representing methods and properties the interface encapsulates; that is, it contains only the declarations for the member procedures. By using Implements statement in a Visual Basic class or form module you declare that module will provide its own version of interface implementation.

SG Window library defines two interfaces: IsgMessageSink and IsgPaintSink. If you implement these interfaces in a VB module and attach this implementation to the SG Window object, interface methods are called from the Window object. That's why we call them callback interfaces.

IsgMessageSink

IsgMessageSink interface contains only one method: Message. This method is called when there is a new enabled message in the window's message queue. For an example of how to use this interface look at Handling Messages topic.

IsgPaintSink

IsgPaintSink is interface specialized for window drawing. It's methods are called when window's client or frame should be painted.

Following example shows how to use IsgPaintSink for drawing on the windows client area:

' Declare interface
Implements IsgPaintSink

' SGWindow object
Private mWnd As SGWindow.Window

Private Sub Class_Initialize()
   ' Initialize SGWindow object
   Set mWnd = New SGWindow.Window
   mWnd.Hooked = True
   mWnd.SetPaintCallback Me
End Sub

Private Function IsgPaintSink_GetFlags() As sgWindow.PaintFlag
   ' Draw client area, and use default frame painting
   IsgPaintSink_GetFlags = pfClientPaint
End Function

Private Sub IsgPaintSink_FramePaint(ByVal hdc As Long)
   ' Use default frame painting
End Sub

Private Sub IsgPaintSink_ClientPaint(ByVal hdc As Long, ByVal left As Long, ByVal top As Long, ByVal right As Long, ByVal bottom As Long)
   ' Draw rectangle over whole client area
   Dim rc As RECT
   GetClientRect mWnd.HWND, rc
   Rectangle hdc, 0, 0, rc.right, rc.bottom
End Sub
Remarks

Main reason why you would want to use callbacks is their speed: callbacks are much faster then standard event mechanism.

For more info about interfaces and Implements keyword, please consult your VB online help and Books Online. Search for the keyword implements.


Creating Windows

SG Window |
Creating Windows | ©1998 by Stinga
Reference Constants Error Codes How To... FAQ

SG Window enables you to create a window from within VB code. To create a window you canl use Create method of the Window object.

The kind (class) of a window and window attributes are specified with the parameters of the Create method. These parameters are:

className | Name of the window class. className can be one of the predefined Win32 class names or it can be a string returned from RegisterClass method.
windowText | Window text.
style | Window style. Can be combination of style constants defined in the WinStyle enumeration
styleEx | Window extended style. Can be combination of style constants defined in the WinStyleEx enumeration
x | Window left coordinate. In pixels an relative to the parent window client rectangle.
y | Window top coordinate. In pixels an relative to the parent window client rectangle.
width | Window width. In pixels.
height | Window height. In pixels.
hwndParent | Parent window handle.
menuOrID | Menu handle, or child-window identifier.

If you pass empty string for className parameter, SG Window will register new class and create window with that class. In this case you are responsible for handling all messages for the created window becasue there is no default window procedure. clsWindow class in the sgWindow.vbp example from your SG Window samples folder shows how you can do it.

For more info please refer to CreateWindow function in Win32 API documetation.

Example

Folowing example creates list view control:

Private wnd As SGWindow.Window

Sub Form_OnLoad()
   set wnd = New SGWindow.Window
   wnd.Create "SysListView32", "", _
       ws_CHILD + ws_BORDER + ws_VISIBLE, _
       0, 10, 10, 400, 300, Me.HWND, 1234
End Sub


Enumerating Windows

SG Window |
Enumerating Windows | ©1998 by Stinga
Reference Events Constants Error Codes How To... FAQ

SG Window library contains handy Windows collection. This collection contains Window objects. Collection of a Window objects can be retrieved as a result of a FindWindows method or from the Children property of the Window object.

Windows collection is a static snapshot. Items are determined at the moment collection is created, so if you cache this collection be aware that some windows may have been destroyed by the time they are used.

Example 1

Following example shows how to find all windows that contain string "Thunder" in their class name:

   Dim desktop As New SGWindow.Window
   Dim wnd As SGWindow.Window
   Dim coll As SGWindow.Windows

   desktop.AttachDesktop
   Set coll = desktop.FindWindows("Thunder", "")
   For Each wnd in coll
      MsgBox wnd.Class & vbCrLf & wnd.Text
   Next
Example 2

Folowing example enumerates desktop window first level children

   Dim desktop As New SGWindow.Window
   Dim wnd As SGWindow.Window

   desktop.AttachDesktop
   Set coll = desktop.Children
   For Each wnd in coll
      MsgBox wnd.Class & vbCrLf & wnd.Text
   Next


SG Window Wizard Overview

SG Window |
SG Window Wizard | © 1998 by Stinga
Reference Registration License How To... FAQ

Sorry. This section is still under construction.

SG Window Wizard source code is located in the Samples folder under the SGWindow installation folder.

New versions and bug fixes can be found at http://www.stinga.com/sgwindow


SG Window Samples List

SG Window |
Samples | © 1998 by Stinga
Reference Registration License How To...

Here is a list of samples installed into the SG Window installation folder. This list may not be complete, so please check samples subfolder in the SG Window installation folder.

Sample | Location | Description
SGWindow | Samples/Test | VB project that explores SG Window features.
SysMenu | Samples/SysMenu | Shows how to add a command into the system menu. Demonstrates callback interfaces.
SelectMenu | Samples/SelectMenu | Demonstrates how to use SG Window to create the reusable VB class that fires events when user select a menu item.
ComboEx | Samples/ComboEx | VB wrapper for the hierarchical combo box from the new common controls dll.
SG Window Wizard | Samples/sgWindowWizard | VB add-in that inserts SG Window into your projects.
WSH Scripts | Samples/Script | Various VBScript and JScript samples. Contains sample that shows how to open user defined dialogs from the VBScript code.
TrayIcon | Samples/TrayIcon | TrayIcon sample is an ActiveX component that can put your application into the system tray.

Newest samples and fixes can be found on our Web site at www.stinga.com/sgwindow.


WindowHandle Constants

SG Window |
WindowHandle Constants | ©1998 by Stinga
Reference Events Constants Error Codes

Constant | Decimal Value
hwnd_BROADCAST | -1
hwnd_DESKTOP | 0
hwnd_TOP | 0
hwnd_BOTTOM | 1
hwnd_TOPMOST | -1
hwnd_NOTOPMOST | -2


SG Window Frequently Asked Questions

SG Window |
FAQ | ©1998 by Stinga


Untitled

SG Window |
Topic Title | ©1998 by Stinga
See Also Overview Properties Methods Events Constants Error Codes How To... FAQ
Description

Syntax
Part | Description

Remarks
Example


Using SG Window

SG Window |
Using SG Window | ©1998 by Stinga
Reference Constants Error Codes

Here is a list of common tasks you can do with SG Window component:


Windows Methods

SG Window |
Windows Methods | ©1998 by Stinga
Objects Windows Properties Constants Error Codes How To... FAQ

The Windows collection has no methods.